﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace D20.Entities.Characters
{
    /// <summary>
    /// A creature's attitude.
    /// </summary>
    public class Attitude
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Attitude"/> class.
        /// </summary>
        public Attitude()
        {
            Alignment = new Alignment();
            Relationships = new List<Relationship>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Attitude"/> class.
        /// </summary>
        /// <param name="alignment">The alignment.</param>
        public Attitude(Alignment alignment)
        {
            Debug.Assert(alignment != null, "alignment != null");
            if (alignment == null)
            {
                throw new ArgumentNullException("alignment");
            }
            Alignment = alignment;
            Relationships = new List<Relationship>();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Attitude"/> class.
        /// </summary>
        /// <param name="alignment">The alignment.</param>
        /// <param name="relationships">The relationships.</param>
        public Attitude(Alignment alignment, IEnumerable<Relationship> relationships)
        {
            Debug.Assert(alignment != null, "alignment != null");
            if (alignment == null)
            {
                throw new ArgumentNullException("alignment");
            }
            Alignment = alignment;

            Debug.Assert(relationships != null, "relationships != null");
            if (relationships == null)
            {
                throw new ArgumentNullException("relationships");
            }
            Relationships = new List<Relationship>(relationships);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Attitude"/> class.
        /// </summary>
        /// <param name="relationships">The relationships.</param>
        public Attitude(IEnumerable<Relationship> relationships)
        {
            Alignment = new Alignment();

            Debug.Assert(relationships != null, "relationships != null");
            if (relationships == null)
            {
                throw new ArgumentNullException("relationships");
            }
            Relationships = new List<Relationship>(relationships);
        }

        /// <summary>
        /// Gets the creature's alignment.
        /// </summary>
        /// <value>The alignment.</value>
        public Alignment Alignment { get; private set; }
        /// <summary>
        /// Gets the relationships with other creatures.
        /// </summary>
        /// <value>The relationships.</value>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
        public List<Relationship> Relationships { get; private set; }
    }
}
